package com.dingwen.treasure.model.entity.mybatisplus;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dingwen.treasure.base.enums.DicTypeEnum;
import com.dingwen.treasure.base.enums.StatusEnum;
import io.swagger.annotations.ApiModel;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 系统字典表: TODO: 覆盖索引
 *
 * @author dingwen
 * @TableName sys_dictionary
 * @date 2022/07/09
 */
@ApiModel(value = "SysDictionary",description = "系统字典持久化对象")
@TableName(value ="sys_dictionary")
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class SysDictionary extends BaseEntity implements Serializable {
    /**
     * 字典ID主键
     */
    @TableId(value = "dic_id", type = IdType.AUTO)
    private Long dicId;

    /**
     * 字典code值
     */
    @TableField(value = "dic_code")
    private String dicCode;

    /**
     * 字典类型： 0普通类型（需要AOP翻译） 1：枚举类型（动态创建枚举类）
     */
    @TableField(value = "dic_type")
    private DicTypeEnum dicType;

    /**
     * 字典名称
     */
    @TableField(value = "dic_name")
    private String dicName;

    /**
     * 字典描述
     */
    @TableField(value = "dic_description")
    private String dicDescription;

    /**
     * 字典父ID
     */
    @TableField(value = "parent_id")
    private Integer parentId;

    /**
     * 字典状态： 0 ：禁用 1： 启用
     */
    @TableField(value = "dic_state")
    private StatusEnum dicState;


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;


    @Builder(toBuilder = true)
    public SysDictionary(LocalDateTime createTime, LocalDateTime updateTime, Integer deleted, Integer version, String createBy, String updateBy, String remark, Long dicId, String dicCode, DicTypeEnum dicType, String dicName, String dicDescription, Integer parentId, StatusEnum dicState) {
        super(createTime, updateTime, deleted, version, createBy, updateBy, remark);
        this.dicId = dicId;
        this.dicCode = dicCode;
        this.dicType = dicType;
        this.dicName = dicName;
        this.dicDescription = dicDescription;
        this.parentId = parentId;
        this.dicState = dicState;
    }
}